<?php use_javascript('jquery.pajinate.js') ?>
<div class="clear"></div>
<div class="content-home">
	<?php 
		$max_article= sfConfig::get('app_max_article_homepage');
		$jj=0; 
		$i=0;
		foreach($journalEncours as $journal) :
	?>
	<div class="titre-news"><h2><?php echo '<span class="titre">'.$journal->getTitre().'</span><span class="numero">'.__('News number :').''.$journal->getId().'</span>' ?></h2></div>
	<div class="resume-new"><?php echo stripslashes($journal->getResume(ESC_RAW)) ?><p class="docjoint"><span><a href="/uploads/journal/<?php echo $journal->getDocjoint()?>" title=""><?php echo __('Click here to download this news')?></a></span></p></div>
	<div id="list-articles">
		<div class="articles">
			<?php foreach($journal->Articles as $article) :?>
			<?php if($i==2){ echo'<div class="clear"></div>';$i=0;}?>
			<div class="news-article">
				<div class="title-rubrique"><h2><a href="<?php echo url_for('detailrubrique',$article->Rubrique,true)?>"><?php echo $article->Rubrique->getTitre() ?></a></h2></div>
				<div class="resume-article"><img src="/uploads/user/<?php $image=$article->sfGuardUser->getUserimage(); if(!empty($image)) {echo $image;} else {echo'noImage.png';}?>" alt="<?php echo $article->sfGuardUser->getUsername() ?>" /><h3><a href="<?php echo url_for('detailarticle',$article,true)?>"><?php echo $article->getTitre() ?></a></h3><?php echo stripslashes($article->getResume(ESC_RAW)) ?><span class="more-details"><a href="<?php echo url_for('detailarticle',$article,true)?>"><?php echo __('read more') ?></a></span></div>
				<div class="clear"></div>
			</div>
			<?php $jj++; $i++; endforeach; ?>
			<div class="clear"></div>
		</div>
		<?php if($jj+2 > $max_article){ ?>
		<div class="page_navigation"></div>
		<?php } ?>
	</div>
<?php  endforeach; ?>
<script type="text/javascript"><!--//--><![CDATA[//><!--
	$(document).ready(function(){
		$('#list-articles').pajinate({
			items_per_page : <?php echo $max_article ?>,
			num_page_links_to_display : 3,
			item_container_id : '.articles',
			nav_label_first : '<<',
			nav_label_last : '>>',
			nav_label_prev : '<',
			nav_label_next : '>'
		});
	});	
//--><!]]></script>
</div>